package org.raymond.icloud.modules.admin.controller;

import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.raymond.icloud.apis.admin.service.InitializeServiceApi;
import org.raymond.icloud.apis.admin.vo.InitEndVO;
import org.raymond.icloud.apis.admin.vo.InitStartVO;
import org.raymond.icloud.common.core.model.Result;
import org.raymond.icloud.modules.admin.service.IInitializeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author raymond
 * @version V1.0
 * @Description: TODO
 */
//@Api(tags = "系统初始化控制器")
@Slf4j
@RestController
public class InitializeController implements InitializeServiceApi {
    @Autowired
    private IInitializeService iInitializeService;

    @Override
    public Result<Boolean> start(InitStartVO inVO) {
        iInitializeService.dropAndCreateAllTable(inVO);
        iInitializeService.initConfiguration(inVO);
        iInitializeService.initTestData(inVO);
        return Result.success(Boolean.TRUE);
    }

    @Override
    public Result<Boolean> end(InitEndVO inVO) {
        iInitializeService.clear(inVO);
        return Result.success(Boolean.TRUE);
    }
}
